<?php if ( ! defined('BASEPATH')) exit('This file does not run directly. Sorry.'); ?>
<?php
/**
 * Kalaisoo.
 *
 * A lightweight no-framework framework written in PHP.
 *
 * @package Kalaisoo
 * @author $Author: info@sah-company.com $
 * @version $Id: test.php 130 2012-01-14 13:29:27Z info@sah-company.com $
 */

/**
 * Load dependencies.
 */
Registry::instance()->loader->model(array(
	'addressbook',
	'page'
	)
);

/**
 * Kalaisoo Test Model Class.
 *
 * @package Kalaisoo
 * @subpackage Model
 * @author $Author: info@sah-company.com $
 */
class Model_Test extends Model
{
	/**
	 * __construct.
	 */
	public function construct()
	{
		parent::__construct();
	}
	
	/**
	 * returns the tags of a bean.
	 *
	 * @return array
	 */
	public function getTags() {
		return array(
		);
	}
	
	/**
	 * loads the array $this->gestalt of this bean for use with Model::gestalt().
	 */
	public function loadGestalten()
	{
		// the default gestalt
		$this->gestalt['default'] = array(
			array(
				'type' => 'text',
				'name' => 'name',
				'parameters' => array(
					'placeholder' => __('test_name_placeholder'),
					'size' => 60,
					'maxlength' => 60,
					'autofocus' => 'autofocus'
				)
			),
			array(
				'type' => 'textarea',
				'name' => 'description',
				'help' => __('test_description_help'),
				'parameters' => array(
					'cols' => 60,
					'rows' => 8
				)
			),
			array(
				'type' => 'select',
				'name' => 'category',
				'parameters' => array(
					'options' => array(
						'verb' => __('verb'),
						'noun' => __('noun'),
						'subject' => __('subject'),
						'object' => __('object')
					)
				)
			),
			array(
				'type' => 'radio',
				'name' => 'suffix',
				'parameters' => array(
					'options' => array(
						'jr' => __('jr.'),
						'sen' => __('sen.'),
						'AG' => __('AG'),
						'GMBH' => __('GmbH')
					)
				)
			),
			array(
				'type' => 'checkbox',
				'name' => 'switch',
				'parameters' => array(
					'value' => '1'
				)
			),
			array(
				'type' => 'file',
				'name' => 'image',
				'parameters' => array(
				)
			),
			array(
				'type' => 'nested',
				'name' => 'person',
				'parameters' => array(
					'selectable' => true
				)
			),
			array(
				'type' => 'own',
				'name' => 'addressbook',
				'parameters' => array(
				)
			),
			array(
				'type' => 'shared',
				'name' => 'page',
				'parameters' => array(
				)
			)
		);
	}
	
	/**
	 * validates the data and returns either true or false.
	 *
	 * @return bool
	 */
	public function validate()
	{
		$valid = true;
		return $valid;
	}

	/**
	 * open.
	 */
	public function open()
	{
	}

	/**
	 * dispense.
	 */
	public function dispense()
	{
		$this->bean->setMeta('buildcommand.unique', array(array('name')));
		$this->bean->name = 'John Doe';
		$this->bean->switch = 1;
		$this->bean->category = 'noun';
		$this->bean->image = 'avatar_3';
	}

	/**
	 * update.
	 */
	public function update()
	{
	}
	
	/**
	 * after_update.
	 */
	public function after_update()
	{
	}
	
	/**
	 * delete.
	 */
	public function delete()
	{
	}
	
	/**
	 * after_delete.
	 */
	public function after_delete()
	{
	}
}
?>